package com.tm.d4_stringBuilder;

/**
 * 2024/5/23 StringBuilder的好处 Cjj 17:14
 */
public class Test2 {
    public static void main(String[] args) {
        //目标：掌握StringbBuilder的好处。
        //需求；要拼接100万次abc
        //先用String测试看看性能
/*        String rs="";
        for (int i = 1; i <1000000 ; i++) {
            rs=rs+"abc";
        }
        System.out.println(rs);
        */

        StringBuilder builder = new StringBuilder();
        for (int i = 1; i < 10000; i++) {
            builder.append("abc");
        }
       System.out.println(builder);


        StringBuffer stringBuffer = new StringBuffer();
        for (int i = 1; i < 10; i++) {
            stringBuffer.append("成姜捷");
        }
        System.out.println(stringBuffer);
    }


}
